package cn.itcast.n5;

/**
 * className: TestFinal
 * description:
 * date: 2023/3/2-14:56
 * <p>
 * project: concurrent
 * package: cn.itcast.n5
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
public class TestFinal {
    static final int A = 10;
    static final int B = Short.MAX_VALUE + 1;

    final int a = 20;
    final int b = Integer.MAX_VALUE;

    final void test1() {
        final int c = 30;
        new Thread(() -> {
            System.out.println(c);
        }).start();

        final int d = 30;
        class Task implements Runnable {

            @Override
            public void run() {
                System.out.println(d);
            }
        }
        new Thread(new Task()).start();
    }
}

class UseFinal1 {
    public void test() {
        System.out.println(TestFinal.A);
        System.out.println(TestFinal.B);
        System.out.println(new TestFinal().a);
        System.out.println(new TestFinal().b);
        new TestFinal().test1();
    }
}

class UseFinal2 {
    public void test() {
        System.out.println(TestFinal.A);
    }
}